std::bitset
From Cppreference
| C++ Standard Library | ||||||||||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Utilities library | ||||||||||||||||||||||||||||||||||||||||||||||||
| ||||||||||||||||||||||||||||||||||||||||||||||||
| std::bitset | ||||||||||||||||||||||||||||||||||||||||||||||||
| Defined in header <bitset>
| ||
| template< size_t N >
class bitset; | ||
Bitsets give the programmer a set of bits as a data structure. Bitsets can be manipulated by various binary operators such as logical AND, OR, and so on.
The size of a C++ bitset is fixed at compile-time, and the size is the template parameter to the bitset.
| This section is incomplete Reason: reference |
Contents |
[edit] Member functions
| constructs the bitset (public member function) | ||
| assigns the contents (public member function) | ||
| compares the contents (public member function) | ||
Element access | |||
| accesses specific bit (public member function) | ||
| accesses specific bit (public member function) | ||
| checks if all, any or none bits are set to true (public member function) | ||
| returns the number of bits set to true (public member function) | ||
Capacity | |||
| returns the size number of bits that the bitset can hold (public member function) | ||
Modifiers | |||
| performs binary AND, OR, XOR and NOT (public member function) | ||
| performs binary shift left and shift right (public member function) | ||
| sets bits to true or given value (public member function) | ||
| sets bits to false (public member function) | ||
| toggles the values of bits (public member function) | ||
Conversions | |||
| returns a string representation of the data (public member function) | ||
| returns an unsigned long integer representation of the data (public member function) | ||
| returns an unsigned long long integer representation of the data (public member function) | ||